package b.h.z.db.convert;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import b.h.z.vo.Column;

@SuppressWarnings("all")
public class ColumnConverter implements ResultConverter<Map> {

	public Map convert(ResultSet rs) throws SQLException {
		Map map = new HashMap<String, List<Column>>();
		while (rs.next()) {
			String tableName = rs.getString(1);
			List list = (List) map.get(tableName);
			if (list == null) {
				list = new ArrayList();
			}
			Column dto = new Column();
			dto.setColName(rs.getString(2));
			dto.setColDesc(rs.getString(3));
			dto.setJavaType(rs.getString(4));
			dto.setXmlType(rs.getString(4));
			dto.setColLen(rs.getString(5));
			dto.setNullAble(rs.getString(6));
			list.add(dto);
			map.put(tableName, list);
		}
		return map;
	}

}
